<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta http-equiv="X-UA-Compatible" content="IE=8">
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<meta content="B2B电商平台" name="description"/>
	<meta content="B2B电商平台" name="keyword"/>
	
	<title>B2B电商平台.分组信息</title>
	<link rel="icon" href="include/images/icss.ico" type="image/x-icon" />
	<link rel="shortcut icon" href="include/images/icss.ico" type="image/x-icon" />
	<link rel="stylesheet" type="text/css" href="<%=path %>/include/css/global.css" />
	<link rel="stylesheet" type="text/css" href="<%=path %>/include/css/style.css" />
	
	<script type="text/javascript" src="<%=path %>/include/js/jquery-1.8.0.min.js"></script>
	<script type="text/javascript" src="<%=path %>/include/js/cookies.js"></script>
	<script type="text/javascript" src="<%=path %>/include/js/icss.busin.js"></script>
	<script type="text/javascript" src="<%=path %>/include/js/icss.common.js"></script>
	<script type="text/javascript" src="<%=path%>/include/layer/layer.js"></script>	
	
	<style type="text/css">
		body{background:#ebebeb;font-size: 14px;padding-left: 0px !important;}
		.title_div{
			height: 81px;
			padding-top: 20px;
			text-align: center;
			//border-bottom: 3px solid #e0e0e0;
			background: #fff;
		}
		.titleCss{
			height: 65px;
			width: 790px;
			margin: 0 auto;
			background: url('<%=path %>/images/postTrade/post_trade_one.png') no-repeat 0 0;
		}
		.title_2{
			background-position: 0 -200px;
		}
		.nextDiv .button2{
		    font: 20px "Microsoft YaHei", "SimHei ";
	    	line-height: 63px;
    		width: 203px;
			background: url('<%=path %>/images/postTrade/pic-global.png') no-repeat -148px -558px;
			color: #fff;
		}
		.nextDiv button {
		    font: 16px "Microsoft YaHei", "SimHei ";
		    line-height: 30px;
		    width: 60px;
		    background: url('<%=path %>/images/postTrade/pic-global.png') no-repeat -150px -578px;
		    color: #fff;
		}
	    .subDiv{
	    	margin: 15px 0px 30px 0px;
	    	height: 33px;
	    	text-align: center;
	    }
	    .nextDiv{
	    	/* width: 279px;
	    	height: 100%; */
	    	margin: 0px auto;
	    }
	    .getDraftCss:hover {
	    	color:red;
	    }
	    .divCss_title{
	    	background: #fff;
		    height: 40px;
		    font: 18px/40px "Microsoft YaHei", "SimHei ";
		    text-indent: 10px;
		    border-bottom: 1px solid #d1d1d1;
		    color: #000;
		   
	    }
	    .tipH4{
	    	width:80px;
	    	float:left;
	    	font-weight: bold;
	    	line-height: 18px;
	    }
	    .borderCss{
	    	border-top: 1px dashed #ccc;margin: 20px 80px;padding-bottom: 5px;
	    }
	    td {
	    	vertical-align: middle;
	    }
	    .tdL{
	    	text-align: right;
	    }
	    
	</style>
  </head>
  
  <body>
    <div id="contentDiv">
    	<input type="hidden" id="codeName" name="codeName">
    	<input type="hidden" id="uuid" name="uuid" value="${uuid}">
    	<div class="title_div" style="display: none;">
	   		<div class="titleCss title_2"></div>
	   	<hr color="#ebebeb" height="0.1px" style="margin-top:13px"/>
	   	</div>
	   	<div style="margin: 0px 0px;background:#fff;font-size: 12px;padding-bottom: 5px;">
	   			<div class="divCss_title" style="display: none;">分组信息
	   			</div>
	   			<div style="padding:20px 0px 0px 20px;">
	   				<table style="width: 100%;line-height: 40px;">
	   				<c:choose>
	   					<c:when test="${bean.STATUS eq 1}">
	   						<tr>
	   						<td class="tdL">分组名称：</td>
	   						<td class="tdR"><input id="groupName" readonly="readonly" name="groupName" value="${bean.GROUP_NAME }"/> </td>
	   					</tr>
	   					<tr>
	   						<td class="tdL">顺序：</td>
	   						<td class="tdR"><input onblur="_checkNum(this.id)" readonly="readonly" id="sortNum" name="sortNum" value="${bean.SORT_NUM }"/> </td>
	   					</tr>
	   					<tr>
	   						<td class="tdL">启用/禁用：</td>
	   						<td class="tdR">
	   							<select id="status" disabled="disabled" name="status" style="height: 20px;width: 150px">
	   								<option <c:if test="${bean.STATUS eq 1}">selected="selected"</c:if> value="1">启用</option>
	   								<option <c:if test="${bean.STATUS eq 0}">selected="selected"</c:if> value="0">禁用</option>
	   							</select>
							</td>
	   					</tr>
	   					</c:when>
	   					<c:otherwise>
	   						<tr>
	   						<td class="tdL">分组名称：</td>
	   						<td class="tdR"><input id="groupName" name="groupName" value="${bean.GROUP_NAME }"/> </td>
	   					</tr>
	   					<tr>
	   						<td class="tdL">顺序：</td>
	   						<td class="tdR"><input onblur="_checkNum(this.id)" id="sortNum" name="sortNum" value="${bean.SORT_NUM }"/> </td>
	   					</tr>
	   					<tr>
	   						<td class="tdL">启用/禁用：</td>
	   						<td class="tdR">
	   							<select id="status" name="status" style="height: 20px;width: 150px">
	   								<option <c:if test="${bean.STATUS eq 1}">selected="selected"</c:if> value="1">启用</option>
	   								<option <c:if test="${bean.STATUS eq 0}">selected="selected"</c:if> value="0">禁用</option>
	   							</select>
							</td>
	   					</tr>
	   					</c:otherwise>
	   				</c:choose>
	   				</table>
	   			</div>
	   			<div class="subDiv">
	   			<c:if test="${bean.STATUS ne 1}">
						<div class="nextDiv">
							<button style="border-radius: 5px;" onclick="_save()">保存</button>
							<button style="border-radius: 5px;" onclick="_closeIframe();">返回</button>
						</div>	
	   			</c:if>
				</div>
	   		</div>		   		
    </div>
  </body>
<script type="text/javascript">
	$(document).ready(function(){
			_reHeight("rightFrame","contentDiv");
	 });
</script>
  <script type="text/javascript">
	  function _checkNum(id){
	  	var val = $("#"+id).val();
			if(!/^[0-9]*$/.test(val)){
				layer.alert("请输入数字!");
				$("#"+id).val("1");
				return;
			}
	  }
  	function _save(){
  	  	var groupName = $("#groupName").val();
  	  	if(groupName == null || groupName == ''){
	  	  	layer.alert("分组名称不能为空");
	  	  	return;
  	  	}
  	  	var sortNum = $("#sortNum").val();
  	  	if(sortNum == null || sortNum == ''){
	  	  	layer.alert("分组名称不能为空");
	  	  	return;
  	  	}
  	  	var status = $("#status").val();
  	  	var uuid = $("#uuid").val();
  	  	
  	  	$.ajax({
  	  	 type:"post",
         url:"<%=path%>/productGroup/saveProductGroupInfo.do",
         dataType:"text",
         data:{uuid:uuid,groupName:groupName,sortNum:sortNum,status:status},
         success:function(data){
         	if(data=="保存成功") {
             	_closeIframe();
            }
         }
  	  	});
  	}
	function _closeIframe(){
		var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
		parent.layer.close(index);
	}
  </script>
</html>
